#include <iostream>
using namespace std;
#define ll long long 
ll check(ll m)
{
	ll sum=0;
	while(m>0)
	{
		sum=sum+m/5;
		m=m/5;
	}
	return sum;
}
int main() 
{
	ll n;
	cin >> n;
	ll l = 1, r = 0x7fffffffffffffff,mid; // long long的最大值
	while (l <r) {
		mid = l + (r - l >> 1);
		if (check(mid) >= n) 
			r = mid;
		else 
			l = mid+1;
	}
	ll ret = check(l);
	if (ret == n) cout << l;
	else cout << -1;
	return 0;
}